home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
amok_lha
/
amok24.lha
/
TurboFiles
/
asm
/
TurboGetPos.asm
< prev
next >
Wrap
Assembly Source File
|
1993-08-15
|
3KB
|
86 lines
;Assemblerversion of the Procedure GetPos from the Module TurboFiles
;Created: 11.6.89 by
; Stefan Salewski
; Stolper Weg 3
; 2160 Stade
;-------------------------------------------------------------------
;The Modula-procedure-header:
;PROCEDURE TurboGetPos(VAR f{11}:File):LONGINT;
;-------------------------------------------------------------------
;TYPE
;Result=(notOpen,done,notdone,openError,readError,writeError,seekError,
; endOfFile,outOfMem,tooManyFiles);
notOpen EQU 0
done EQU 1
notDone EQU 2
openError EQU 3
readError EQU 4
writeError EQU 5
seekError EQU 6
endOfFile EQU 7
outOfMem EQU 8
tooManyFile EQU 9
;-------------------------------------------------------------------
;Modes of Dos.Seek
Dos_beginning EQU -1
Dos_current EQU 0
Dos_end EQU 1
;-------------------------------------------------------------------
;The Modula-Datastructure:
;File=RECORD
; fhPtr:Dos.FileHandlePtr;
; dosBase:ADDRESS;
; base:ADDRESS;
; top:ADDRESS;
; filePos:LONGINT;
; startLength:LONGINT;
; act:CharPtr;
; readTop:ADDRESS;
; writeBase:ADDRESS;
; writeTop:ADDRESS;
; res:Result;
; END;
;The offsets in the File-Variable:
_fhPtr EQU 0
_dosBase EQU 4
_base EQU 8
_top EQU 12
_filePos EQU 16
_startLength EQU 20
_act EQU 24
_readTop EQU 28
_writeBase EQU 32
_writeTop EQU 36
_res EQU 40
;-------------------------------------------------------------------
;The offsets of the Dos-functions:
_Seek EQU -66
_Write EQU -48
_Read EQU -42
;-------------------------------------------------------------------
; We can use all registers except A4, A5 (and A7 of course)
; A0, A1, D0, D1 are not resistent against changes by Dos-Funktions,
; and I changes than too by myself.
; I don't use D0 and D1 as registerparameters in the ProcedureHaeder,
; because they are used to evaluate the Procedure-parameters.
;-------------------------------------------------------------------
;The address of the file-variable I get from the Compiler in the register A3
;The result is allways given back in D0
f EQUR A3; ADDRESS (The address of the file-variable)
;-------------------------------------------------------------------
Start: ;(of GetPos)
CMPI.B #done,_res(f)
BNE.S Error
MOVE.L _filePos(f),D0
ADD.L _act(f),D0
SUB.L _readTop(f),D0
RTS
Error:
MOVEQ.L #-1,D0
TheEnd:
RTS
END